home *** CD-ROM | disk | FTP | other *** search
- /*
- File: Notification.h
-
- Contains: Notification Manager interfaces
-
- Version: Technology: System 7.5
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- */
- #ifndef __NOTIFICATION__
- #define __NOTIFICATION__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
- #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
- #ifndef __OSUTILS__
- #include <OSUtils.h>
- #endif
- #endif
- #ifndef __COLLECTIONS__
- #include <Collections.h>
- #endif
- #ifndef __KERNEL__
- #include <Kernel.h>
- #endif
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import on
- #endif
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=mac68k
- #endif
-
- /* ------------------ */
- #if FOR_SYSTEM8_PREEMPTIVE
- typedef struct OpaqueNotificationRef* NotificationRef;
- /* notification status flags */
-
- enum {
- kInvalidNotification = 1, /* notification ref invalid */
- kUnSentNotification = 2, /* notification not yet sent */
- kPostedNotification = 3 /* notification has been posted */
- };
-
- typedef UInt32 NotificationStatus;
- /* notification tags */
-
- enum {
- kNotificationTypeTag = 'type', /* type of notification (multiple types allowed) */
- kNotificationRefTag = 'nref', /* notification ref (usually retrieved at completion) */
- kTextNotificationTag = 'text', /* ASCII text */
- kTextObjectNotificationTag = 'tobj', /* text object model format text */
- kSoundNotificationTag = 'snd ', /* sound data in format of 'snd ' resource */
- kSmall8BitIconTag = 'ics8', /* 8-bit icon */
- kSmall4BitIconTag = 'ics4', /* 4-bit icon */
- kSmall1BitMaskIconTag = 'ics#', /* 1-bit icon w/mask */
- kProcessSerialNumberTag = 'psn ' /* psn we wish to mark */
- };
-
- /* notification module identifiers */
-
- enum {
- kAlertNotifier = 'alrt', /* display a modal alert with OK button */
- kSoundNotifier = 'snd ', /* play a sound */
- kProcessMenuNotifier = 'pmnu', /* flash icon in title of process menu */
- kAppleMenuNotifier = 'amnu', /* flash icon in title of apple menu */
- kMenuMarkNotifier = 'mmrk' /* put a mark in the process menu */
- };
-
- typedef OSType NotifierType;
- /* notification posting options */
-
- enum {
- kAutoDisposeOnCompletionMask = (1L << 0) /* dispose the notification request on completion */
- };
-
- typedef OptionBits NotificationOptions;
- /* ------------------ */
- extern pascal OSStatus NewNotificationRef(NotificationRef *notification);
-
- extern pascal OSStatus AddNotificationCollectionItem(NotificationRef notification, CollectionTag tag, UInt32 id, void *itemData, ByteCount itemSize);
-
- extern pascal OSStatus GetNotificationCollectionItem(NotificationRef notification, CollectionTag tag, UInt32 id, void **dataPtr, ByteCount *itemSize);
-
- extern pascal OSStatus PostNotification(NotificationRef notification, const KernelNotification *completion, Duration timeOut, NotificationOptions postingOptions);
-
- extern pascal NotificationStatus GetNotificationStatus(NotificationRef notification);
-
- extern pascal OSStatus DisposeNotificationRef(NotificationRef notification);
-
- extern pascal OSStatus NewNotificationRefFromMemory(void *messageBuffer, ByteCount size, NotificationRef *notification);
-
- extern pascal ByteCount GetFlattenedNotificationSize(NotificationRef notification);
-
- extern pascal OSStatus FlattenNotification(NotificationRef notification, void *buffer);
-
- #endif
- /* ------------------ */
- /* ------------------ */
- #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
- typedef struct NMRec NMRec;
- typedef NMRec *NMRecPtr;
- typedef pascal void (*NMProcPtr)(NMRecPtr nmReqPtr);
-
- #if GENERATINGCFM
- typedef UniversalProcPtr NMUPP;
- #else
- typedef NMProcPtr NMUPP;
- #endif
- struct NMRec {
- QElemPtr qLink; /* next queue entry*/
- short qType; /* queue type -- ORD(nmType) = 8*/
- short nmFlags; /* reserved*/
- long nmPrivate; /* reserved*/
- short nmReserved; /* reserved*/
- short nmMark; /* item to mark in Apple menu*/
- Handle nmIcon; /* handle to small icon*/
- Handle nmSound; /* handle to sound record*/
- StringPtr nmStr; /* string to appear in alert*/
- NMUPP nmResp; /* pointer to response routine*/
- long nmRefCon; /* for application use*/
- };
-
-
- enum {
- uppNMProcInfo = kPascalStackBased
- | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(NMRecPtr)))
- };
-
- #if GENERATINGCFM
- #define CallNMProc(userRoutine, nmReqPtr) \
- CallUniversalProc((UniversalProcPtr)(userRoutine), uppNMProcInfo, (nmReqPtr))
- #else
- #define CallNMProc(userRoutine, nmReqPtr) \
- (*(userRoutine))((nmReqPtr))
- #endif
-
- #if GENERATINGCFM
- #define NewNMProc(userRoutine) \
- (NMUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppNMProcInfo, GetCurrentArchitecture())
- #else
- #define NewNMProc(userRoutine) \
- ((NMUPP) (userRoutine))
- #endif
- /* ------------------ */
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 NMInstall(__A0)
- #endif
- extern pascal OSErr NMInstall(NMRecPtr nmReqPtr)
- ONEWORDINLINE(0xA05E);
-
-
- #if GENERATING68K && !GENERATINGCFM
- #pragma parameter __D0 NMRemove(__A0)
- #endif
- extern pascal OSErr NMRemove(NMRecPtr nmReqPtr)
- ONEWORDINLINE(0xA05F);
-
- #endif
- /* ------------------ */
-
- #if PRAGMA_ALIGN_SUPPORTED
- #pragma options align=reset
- #endif
-
- #if PRAGMA_IMPORT_SUPPORTED
- #pragma import off
- #endif
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif /* __NOTIFICATION__ */
-
-